// 主入口程序

import { Server } from "http"
import CONSTANTS from "configs/constants"
import createServer from "configs/application"
import log4js from "app/utils/log4js"

module.exports = (async (): Promise<Server> => {
    try {
        console.log("main")
        const app = await createServer();

        return app.listen(CONSTANTS.SERVER_PORT, ()=>{
            // console.log(`服务已启动，端口: ${CONSTANTS.SERVER_PORT}`)
            log4js.info(`服务已启动，端口: ${CONSTANTS.SERVER_PORT}`)
        })
    }catch(e){
        console.error(e)
    }
})()